clean up the code for reading and writing the data