The above is then used to generate a webpage and the results are shown in the first screenshot attachments

This data is also used (and formatted) to be sent out a USB port as serial data. As you might expect, parsing everything would be easier if the table entries (specifically the command, port, sub and cdata columns) were more consistent. As such I wanted to change the first group's format to:

The second screenshot attachment shows what is displayed if this change it made. For the life of me, I can't get the inherited php code to work with my modified table entries and I sure would appreciate some help!