changed the segmenting method