updated to output csv