Added comments to the js code