possibly working harmony detector, needs rewrite