Improved minimum and maximum calculation.