Renamed Context to ResourcesContext and other small rafactorings.
Minor scoping test fixes.