Introduced lazy type and some related optimizations.
Removed assertion since it could appear in normal situation.
Extracted SubpackagesScope.
Importing root scope without members.