Committing centralizing the tag-finding code to a single function, and cleaning up some initialization code.