scope refactoring