add comments & improve index.js