refactor favorites/likes functions