added some comments to the javascript