Simplify Parser and ParseResult
Extract some loops and conditions up