refactoring how $usedNamespaces is accessed / used