Added implementation for reading and writing