moved CSV file writer into its own class