first try at a better max/min, considering intermediate points.