clean data for segmentation