Modifying segmentation function and adding segment class