a little restructuring to add thead and tbody