Fixed the file writing system, commented a bit