add weights calculation