Copied from RealThunder's TopoNaming branch and modified only as much as required to enable compilation.