Added decleration for ai function