The nesting and flags and var is a bit hard to follow here. Do you need them for the tailrec, or is it possible to call `process` from within the cases and get rid of `recurse` and `intex`?