stateMachine and state should be functional