Refactoring the H calculation.