extracted the StateMachine-class