changed out.csv destination and refactoring