commented in getMinMax function