Switched mismatched max and min calculations.