refine the csv file