Parser refactor

Moving discussion to a PR.