Scopes refactoring.
27 files changed