Pull computation of correct result out into a separate function.