Added some comments and removed some console.log