Made center of mass a textserver-level function