update the function