Now you get an error because it selects y_max = y_min = y
Now you get an error because it selects y_max = y_min = y