peak detection implemented, untested