table2 code cleanup