Improved proxy selection algorithm.