more refactoring and consolidation of loading scripts