added the explanatory comments to the functions