fixing a missing code piece + adding comments to js code