DRY up some code in CSV generation.