stateMachine works