integrating the awesome DistThresholdCHOP from Vincent Houze