Implemented AI saving and loading.