work on new read and write functions