Well, why not?
note: the only important change and a 'special case' is the change of delimiters so that the string ", cap" is not cosidered to be a comma anymore.
The rest of the changes are either cosmetic, or removal of some complex cases and questionalbe flow control which seemed to me as completely unnecessary.
In fact, I was quite conservative, if I had more confidence, I would have removed about half the code. But before I do that I need at least to set up my development environment correctly, this ad-hoc setup that I glued together is quite frustrating.