Started the big refactor based on the introduction of the grammar context