index.js refactoring