A few changes to use the AI lib