csv_transform refactored