The split patches are much nicer to read, thanks. I think that approach can help a lot with improving patch review times. The last patch is still pretty large, but at least the control flow is simple.
Another round of minor things, but I feel this is essentially ready.