Added comments to the two functions