Fixed return expression of segmentation
Added cluster extraction function