AI logic - still has issues