made functions for reading and writing csv files and non-csv files private