Added optimizations for ActiveSegment(), starting to build composePiecewise
generators for Min() and Max()