added comments to some code