Added most of the logic to display the results in the table.