Restructured index.js