added print to csv functionality