Generalize the table construction a bit.