Tag index

Just starting on this, not for merging yet, but feedback welcome.
It seems like we'd know the exact representation of `r`. Can we do an equality test instead of a "contains" test?