modify weighting function