Yes that's exactly what I mean. Apologies for the confusion.
Overnight I had the idea that a good approach to this might be to create a temporary 16 by 16 array and then for each element in the original array; copy values across IF they are not null/zero. The new array would then be arranged as in the above example. ie no gaps in the middle.
Testing now...
UPDATE. Not possible because it seems there is no simple way to just push something to the end of a 2d array. ?!?
It looks like another approach maybe to convert everything down to a 1d array, do the edits and then turn it back into a 2d array.
Another idea is to have 16 1 dimensional arrays of 16 elements each...
...although I suspect this is waaay overcomplicated for what it needs to be.
Accepting all ideas here :)