Understood - essentially, you are resetting to infinity all of the corners that are already calculated to be closest to one of the image corners.