Implemented write() functions