added debug print statements to extractPeaks