refactored results into csv