change name of write function