Simplify the read call.

Based on the feedback.
correctly return the right error codes
Simpify the write operations.