Implemented the write and the read methods