Made adjustments for when there is only one row of a table.