made a med_diff counter to counteract larger amounts of oscillators, with bigger threshold