Changes to support more scopes.