Updated based on code review, rewrite parser based on grammar from Jason