added a bunch of stuff for working with tags