Finished read and write. TODO: delete, length