Task: switch defaultdict to collections.Counter

We switch from using `defaultdict` to `collections.Counter` because
Counter objects are simpler and designed more for the purpose for which
using defaultdict objects had served.