Forum Moderators: open
I reckon it would be better to change the values (and attributes if necessary) of the table cells, rather than creating a new table. Creating new tables might lead to memory loss.
An array might make the process - and the sorting - easier. Again, it's not 100% necessary.