refactored csv validation