Added the read and write to file methods.