almost done re-organizing the grammar