Implement new weighting function