update to calc barycenter function