Changed where numPeaks is calculated

Calculate it in findPeaks.