switch .write api to be simpler