Minor tweaks and added some comments to javascript file.