I added some comments and modified some code