Collapse common namespace hierarchy.