added center of mass function to updates