Modified function that creates the table