memory usage optimizations for read and write operations

If we rename the type or variables we may be able to merge these two lines. If not, the current form is good.