added comments to the code