improved scope usage
small refactoring