Yeah, I saw that when I read later.  The code looks good, although I agree with @daleharvey that it's really difficult to reason about.