Reduced code by making more methods for reading and writing to files. Added more comments