tag fixes, typo fix and a code refactoring

There's still a lot to refactor; however, I've decided to open this pull request because of df856e1 and 7df65cf