added comments to some functions