added some more comments to the code