code to parallelize tag_counts