changed weighting from max to min