refactor app/index.js into functional sections