improved formatting and refactored csv call