Added replacements for categories and tags

Also improved docblocks and added author credit for @GaryJones for the
code that he has written.