changed threshold to detect peaks more effectively