Added method to sanitize tag input.