loading and index.js refactoring