Modified segmenter algo to work with getSamples()