added comments, removed console.logs