Refactored calculations.