Add read/write.
Add putsegment.
Error checking in _test.