organized some code in addfavorite and favoriteslist