Fixed missing else (if instead of else if) in detectPeaks, alerted by MC1 on the forum.
Lumped in with hotfix to merge into master, because it is a minor change that was higly unlikely to cause issues.