Minor cleanup of rate function