Updated AI Logic and control