Refactor tag extractor.