Tweak custom tag support; Add unit tests (Feature request #438)