added methods to write objects to files and removed the corresponding debug flags