added write funcs