Wrote code to dump namespace hierarchy and fixed a loop in the hierarchy.