Adding helper function to format a table from a nested list