create unit tests and refactor TagIterator to namespace