center of mass calculations working