Fixed correct gm2 and gm3 functions.
Fixed correct name of state inputs.