Restored BrookExtractPathLevels() procedure