refactoring exportcsv