removed some console logging and added a couple of comments