refactored so it downloads csv