Changed how csv files are created and emailed