refactored grammar and introduced table scaffolding