Can detect minima and maxima now