implement segmentation