optimized get_joints