removed some comments
more stuff
fixed bug in writing long filenames, omitted termination character