finished extractPeaks wrapping in both directions