Moved some code from LangPlugin to indexer