added jlethinens way for computing weights