added ability to stop at first threshold found if Dmax < 0