handle scopes in xchooser code
handle scopes even better