Code refactoring for custom tag.