scope refactor