added comments to all functions

added comments to all functions