removed console.log messages and added some comments