Add StateMachine class