worked on writeCSV()