added some comments to a couple of functions