Refactor saveCSVFile
Closes #9