encoder of state variables works..