Buggy center of mass code