Make findPeak correct for corner cases
Prettify.