Refactor for scope matters