new version of csv and refactorings