changes to getMinAndMax method