WIP: factoring out common code from IK arm/leg.