Made the parser logic a bit cleaner.

@wedaly