CSV reading refactoring