Rewriting and simplification of the tag library.
Lots of refactoring.
Added some documentation.