added new feature, isSegmentPair