Refactoring AISystem.