[Resolver] Refactored way of handling scope changes. Still having regressions.