Simplify the parser a little
Factor out some redundant code