adding more comments and removing a console.log from error