making some adjustments to account for find peaks behavior