added some js and comments