restructured index.js