Added logic for favorites.