Refactor the tag controller.