added some comments to further explain the example code