Implemented file writing and reading.