Refactor Method:
* index.js port
* Added notes and comments