OK, I now understand that after reading the Arduino docs.
Only thing I would need to do is to check that when the CMDxxx is received that the xxx is only 3 characters. So the Indexof traps the CMD part but it would also work with CMDxxxxxxxx...., so I need to check the total length of the command received.
Seems pretty straight forward. And works!
Thanks