Added comments, removed console.log() in js