Untested initial implementation of write.