Added Center of mass calculation