Modified finder for peaks and troughs