Simply replace the mean as derived above in the original function.