Removed some duplicate code in the parser + other minor cleanups

The main change was adding an 'optional' param to parseGroup removing the need for parseOptionalGroup.  There are some other minor changes which I'll comment below.
Removes the need for the else statement on line 488.