Get rid of recursion in segment parser, gives us a huge performance boost, thanks to @RalphSchindler