Reformating and whitespace.
Unclobber python file object type. Also actually call file close.
Get rid of static directory path in favor of using getcwd(). Also use python magic to create file names in a crossplatform way.
Some refactoring of the main function.
Give opened files more descriptive names.
Use with to open files. Requires >= Python2.5.
Some easy refactoring.
Label magic numbers as such.
Change a magic number to get correct comma amount. Lots of whitespace manipulation to get output to match what's in the repo. Terrain_header mistaken truncation fix.