CORE index.js refactoring