refactor csv works