Rewrote pool read/write to fix several critical bugs

May have introduced new bugs