Add comments to index.js
Add the algorithm used