Added weighted sum and average