Problem creating 3 cells per row in table

But there are times when there may only be 1 or 2 cells in a row. So a row is not necessarily finished only after the 3rd cell.
It is working fine now except when I uncheck a few boxes and items should be removed from the subs object. The items in subs no longer are in the order of
(row, column)
(0,0), (0,1),(0,2),(1,0),(1,1),(1,2),(2,0)…etc.
The subs object can end up like this,

subjects: AS rows: 0 columns: 0 result: Geography,Mathematics search:399:2
subjects: GCSE rows: 0 columns: 2 result: gcseBiology search:399:2
subjects: A2 rows: 0 columns: 1 result: Further Mathematics

This causes problems having 0,2 before 0,1.
Either I can go back and try to see where and why this disordering takes place or I could try to write a function that will create a new object from subs called orderedSubs{} which will have the rows and columns in the correct order.
Paul_Wilkins did warn me in another thread about the order of the array.
There’s another problem that you’re going to have, and that is the
properties of an object can not be guaranteed to always be processed in
the same order.

I think that is coming back to haunt me now.
Thanks