Refactoring CSV file