added max_min2 method which enhances peak detection