added comments to all functions