read buffering working for entire file, needs some cleanup, writing still missing