implemented weighted center