write_function: changed output format