csv refactoring