Refactor update_tag_link_counts