Add comments to explain the functions