Redesign check_csv.sh for huge performance improvement