added a few comments on JS functions