added some comments in JS