I know this code probably already existed, but I don't think we need this `tmp` local here.  It seems clearer just to use `scratchCartesian` directly throughout.