changed least to min, greastest to max