Switching to csv file as output