StateMachine abstraction