fill in file write functions