added some comments to indicate the function of the api functions