updated rate function