Added StateMachine initialization and reflexive state identification.