the state machine works!!