added comments to describe functions