Added fieldOrder array to define order to write out records