working thru exercise 1, functions read/write