improve the csv export to make flat csvs with column headers