added writing and reading from file