added csv sniffer function to handle file format issues