Rewrote _tagRefs in newish style

Checkpoint.  Introduced a few unit tests for _tagRefs, which demonstrate
that it can't cope with tags in Model Values.  That isn't fixed yet, but
the rewrite at least begins to make it plausible.