update to a sequential char-by-char parser to fix issues with nested loop tags

+ other fixes, see commit for details