edit for faster stream read/write