Changing way agent state is handled & hooking up some events to maintain it.