Also, for each id moved out of the `_pendingScopes` queue and inserted into the `defaultScopeOrder` queue, I think the code needs to recursively then check the `_pendingScopes` queue again for any scopes pending its insertion.