clean up tables, consolidate rows