Update index.js

Implemented all TODO sections