tagCount implementation