separated out the table generation