Refactor RootScope

Fixes #1049