refactor grammar, full model layout, add appendix