Update badge when removing recipes from favorites and refactor js