Move tag input code into plugin framework