Update index.js

Implemented all "TO DO" sections