added calcWeights method.