Added export to csv functionality.