Code cleanup
Separated grammar building from the table building