revised file reading and writing
fixed some comments, got rid of unused imports