Refactored logic for upvote creation and redirection.