added license and comments to javascript file