Stop using $root from upper scopes
Merge pull request #296 from radford/avoid-global-root

Stop using $root from upper scopes