diff --git a/flatpages/views.py b/flatpages/views.py
index f411bfa..1a445ea 100644
--- a/flatpages/views.py
+++ b/flatpages/views.py
@@ -35,6 +35,7 @@ def flatpage(request, path):
 
 
     if path.startswith("noinfo") and settings.PUBLIC_SITE and not request.user.is_authenticated():
+        print "flat path noinfo", path
         return HttpResponseRedirect(reverse("auth_login") + '?next=%s' % request.path)
 
     if path.endswith("/") or path == "":        
@@ -56,17 +57,22 @@ def flatpage(request, path):
         html = o.read()
         
         m = re.search(r"<head>(.*)</head>.*<body>(.*)</body>", html, re.DOTALL)
-        mwithid = re.search(r'<head>(.*)</head>.*<body id="([^"]*)">(.*)</body>', html, re.DOTALL)
         if m:
             head, body = m.groups()
-            bodyid = None
-        elif mwithid:
-            head, bodyid, body = mwithid.groups()
         else:
             return HttpResponse(html + "Page could not be split into header and body")
+        m = re.search(r"<title>(.*)</title>", head, re.DOTALL)
+        if m:
+            title, = m.groups()
+        else:
+            title = ""
+        linksmatch = re.match('(.*)<ul id="links">', body, re.DOTALL)
+        if linksmatch:
+            body, = linksmatch.groups()
         if re.search(r"iso-8859-1", html):
             body = unicode(body, "iso-8859-1")
-        return render_with_context(request, 'flatpage.html', {'editable': True, 'path': path, 'head': head, 'body': body, "bodyid": bodyid})
+            body.strip
+        return render_with_context(request, 'flatpage.html', {'editable': True, 'path': path, 'head': head, 'body': body, 'homepage': (path == "index.htm")})
     else:
         return HttpResponse(o.read(), mimetype=getmimetype(path))
 
@@ -106,6 +112,9 @@ def editflatpage(request, path):
     if m:
         head, body = m.groups()
         if re.search(r"iso-8859-1", html):
+            linksmatch = re.match('(.*)<ul id="links">', body, re.DOTALL)
+            if linksmatch:
+                body, = linksmatch.groups()
             body = unicode(body, "iso-8859-1")
     else:
         return HttpResponse("Page could not be split into header and body")
@@ -114,13 +123,20 @@ def editflatpage(request, path):
         if flatpageForm.is_valid():# Form valid therefore write file
             f = open(filepath, "w")
             template = loader.get_template('dataformat/flatfile.html')
-            context = Context({'form': flatpageForm.cleaned_data, 'head': head})
+            context = Context({'form': flatpageForm.cleaned_data})
             f.write(template.render(context))
             f.close()
             return HttpResponseRedirect(reverse('flatpage', args=[path])) # Redirect after POST
     else:
-        flatpageForm = FlatPageForm({"html": body})
+        m = re.search(r"<title>(.*)</title>", head, re.DOTALL)
+        if m: 
+            title, = m.groups()
+        else:
+            title = ""
+        flatpageForm = FlatPageForm({"html": body, "title": title})
     return render_with_context(request, 'editflatpage.html', {'path': path, 'form': flatpageForm, })
 
 class FlatPageForm(forms.Form):
-        html = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30}))
+    title = forms.CharField(widget=forms.TextInput(attrs={'size':'60'}))
+
+    html = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30}))
diff --git a/templates/cavebase.html b/templates/cavebase.html
index 7e83151..a0ffd4d 100644
--- a/templates/cavebase.html
+++ b/templates/cavebase.html
@@ -16,11 +16,6 @@
 </head>
 <body>
 {% block content %}{% endblock %}
-{% block menu %}
-<ul id="links">
-<li>Back to <a href="/index.htm">Expedition home page</a></li>
-<li>Back to <a href="http://cucc.survex.com/">CUCC home page</a></li>
-</ul>
-{% endblock %}
+{% include "menu.html" %}
 </body>
 </html>
diff --git a/templates/dataformat/flatfile.html b/templates/dataformat/flatfile.html
index 1ddb7a5..048606e 100644
--- a/templates/dataformat/flatfile.html
+++ b/templates/dataformat/flatfile.html
@@ -1,7 +1,9 @@
 {% autoescape off %}
 <html>
 <head>
-{{ head }}
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<title>{{ form.title }}</title>
+<link rel="stylesheet" type="text/css" href="css/main2.css" />
 </head>
 <body>
 {{ form.html }}
diff --git a/templates/editflatpage.html b/templates/editflatpage.html
index 85a5bcc..67290a7 100644
--- a/templates/editflatpage.html
+++ b/templates/editflatpage.html
@@ -6,7 +6,7 @@
 {% endblock %}
 {% block content %}
 <form action="" method="post">{% csrf_token %}
-{{form}}
+{{form.as_p}}
 <p><input type="submit" value="Submit" /></p>
 </form>
 {% endblock %}
diff --git a/templates/flatpage.html b/templates/flatpage.html
index 04ff1f8..42b8481 100644
--- a/templates/flatpage.html
+++ b/templates/flatpage.html
@@ -2,9 +2,9 @@
 <head>
 {{ head|safe }}
 </head>
-<body{% if bodyid %} id="{{ bodyid }}"{% endif %}>
+<body{% if homepage %} id="homepage"{% endif %}>
 {{ body|safe }}
-{% if editable %}<a href="{% url editflatpage path %}">Edit</a>{% endif %}
-<a href="/troggle">Troggle</a>
+
+{% include "menu.html" %}
 </body>
 </html>
diff --git a/templates/menu.html b/templates/menu.html
new file mode 100644
index 0000000..f74aed4
--- /dev/null
+++ b/templates/menu.html
@@ -0,0 +1,12 @@
+{% if not homepage %}
+<ul id="links">
+<li><a href="/index.htm">Home</a></li>
+<li><a href="/infodx.htm">Main Index</a></li>
+<li><a href="/troggle">Troggle</a></li>
+<li><a href="/areas.htm">Areas</a></li>
+<li><a href="/indxal.htm">Caves</a></li>
+<li><a href="/handbook/index.htm">Handbook</a></li>
+<li><a href="/pubs.htm">Reports</a></li>
+{% if editable %}<li><a href="{% url editflatpage path %}">Edit</a></li>{% endif %}
+</ul>
+{% endif %}