Added more functions to AI to account for new situations