program now looks for max and min values.