Moved some QueryExpander code into companion object.