Re-work the document scoping.