added stateMachine