Introduce a TreeScope so we can get to the root node in O(1)
Merge pull request #388 from arv/tree-scope

Introduce a TreeScope so we can get to the root node in O(1)