Added local peak detection