added AI functions definition