new write function