added the read from a file and write to a file methods