AI State refactoring.