Adds write and read functions