Refactor to use simplegrammar rules and parser