Consolidating functions.  We could also put two of the helper functions into mutual information but the function would be huge.