Reworks the table code