Made program overall more efficient by only changing modified rows not whole table, loop over array once not twice for tableData, sortOrders