refactor and rename

removed indirection for reading and writing where possible