extract upvotes logic