write_file clearer version