Added more comments to the function definitions