added sample segmentation code