added AI functionality