update the weight calculation method