Fixing the table builder function 2