Fixing unused detection

A couple issues prevented the unused detection from working correctly,
fixed the occasional infinite loop, added some tags that weren't
previously checked.