update -> index.js
cleaning and refactoring