Updated AI algorithm