Removed dependency on MainActivity from StateMachine and other code.