Added the rest of the file reading and writing