Improve path-munging to use hierarchies.