revised index.js