added more logic to AI