better approach to table construction