added some logic to reorder columns for the final export