added first_harmonic control and switching between up and rnd mode