Added backend ai functionality