get trimSegment to work