Updated to handle new AI flag