this one might be critical when there are different number of points, could you just use the number of points in the joint vector? Then this is already ready for the future