clean up read/write macros