Refactored scope selection, it now shows only scopes that are used in current tree.