Scope refactoring