In buildtoc, refactor the flow logic in podset() to avoid most uses of next.