diff --git a/export/tocavetab.py b/export/tocavetab.py
index 5be866c..121c36e 100644
--- a/export/tocavetab.py
+++ b/export/tocavetab.py
@@ -5,75 +5,48 @@ import csv
 import re
 import os
 
-##format of CAVETAB2.CSV is
-KatasterNumber = 0
-KatStatusCode = 1
-Entrances = 2
-UnofficialNumber = 3
-MultipleEntrances = 4
-AutogenFile = 5
-LinkFile = 6
-LinkEntrance = 7
-Name = 8
-UnofficialName = 9
-Comment = 10
-Area = 11
-Explorers = 12
-UndergroundDescription = 13
-Equipment = 14
-QMList = 15
-KatasterStatus = 16
-References = 17
-UndergroundCentreLine = 18
-UndergroundDrawnSurvey = 19
-SurvexFile = 20
-Length = 21
-Depth = 22
-Extent = 23
-Notes = 24
-EntranceName = 25
-TagPoint = 26
-OtherPoint = 27
-DescriptionOfOtherPoint = 28
-ExactEntrance = 29
-TypeOfFix = 30
-GPSpreSA = 31
-GPSpostSA = 32
-Northing = 33
-Easting = 34
-Altitude = 35
-Bearings = 36
-Map = 37
-Location = 38
-Approach = 39
-EntranceDescription = 40
-PhotoOfLocation = 41
-Marking = 42
-MarkingComment = 43
-Findability = 44
-FindabilityComment = 45
-
-##format of CAVETAB2.CSV is
+#format of CAVETAB2.CSV is
 headers=['KatasterNumber','KatStatusCode','Entrances','UnofficialNumber','MultipleEntrances','AutogenFile','LinkFile','LinkEntrance','Name','UnofficialName',
  'Comment','Area','Explorers','UndergroundDescription','Equipment','QMList','KatasterStatus','References','UndergroundCentreLine','UndergroundDrawnSurvey',
  'SurvexFile','Length','Depth','Extent','Notes','EntranceName','TagPoint','OtherPoint','DescriptionOfOtherPoint','ExactEntrance','TypeOfFix','GPSpreSA',
  'GPSpostSA','Northing','Easting','Altitude','Bearings','Map','Location','Approach','EntranceDescription','PhotoOfLocation','Marking','MarkingComment',
  'Findability','FindabilityComment']
-headersDict={}
-x=0
-for column in headers:
-    headersDict[x]=column
-    x+=1
-print headersDict
+
+def cavetabRow(cave):
+    #mapping of troggle models to table columns is: (guess this could just be a tuple of tuples rather than a dictionary actually)
+    columnsToModelFields={
+        'Name':cave.official_name,
+        'Area':cave.kat_area(),
+        'KatStatusCode':cave.kataster_code,
+        'KatasterNumber':cave.kataster_number,
+        'UnofficialNumber':cave.unofficial_number,
+        #'' : cave.entrances 		This is a multiple foreignkey now, may be tricky to dump back into csv. Work on this.
+        'Explorers':cave.explorers,
+        'UndergroundDescription':cave.underground_description,
+        'Equipment':cave.equipment,
+        'References':cave.references,
+        'UndergroundDrawnSurvey':cave.survey,
+        'KatasterStatus':cave.kataster_status,
+        'UndergroundCentreLine':cave.underground_centre_line,
+        'Notes':cave.notes,
+        'Length':cave.length,
+        'Depth':cave.depth,
+        'Extent':cave.extent,
+        'SurvexFile':cave.survex_file,
+        }
+        
+    caveRow=['' for x in range(len(headers))]
+    for column, modelField in columnsToModelFields.items():
+        if modelField:
+            # Very sorry about the atrocious replace below. I will fix this soon if noone beats me to it. - AC
+            caveRow[headers.index(column)]=modelField.replace(u'\xd7','x').replace(u'\u201c','').replace(u'\u2013','').replace(u'\xbd','')
+    return caveRow
 
 def writeCaveTab(path):
     outfile=file(path,'w')
-    cavewriter=csv.writer(outfile)
-    cavewriter.writerows
-    for cave in Cave.objects.all():
-        caverow[KatasterNumber]=cave.kataster_number
-        caverow[KatStatusCode]=cave.katasternumber
+    cavewriter=csv.writer(outfile,lineterminator='\r')
+    cavewriter.writerow(headers)
+    for cave in models.Cave.objects.all():
+        cavewriter.writerow(cavetabRow(cave))
+
 
-def addCell(caverow, attribute):
-    caverow[attribute]=cave.attribute
-