added logic to display favorite/unfavorite buttons