An array can be made to work and so could your code as it is written, but...

One of the things you need to consider is, how is the data coming into the MCU?
123
1,2,3
12,3
12M3
...........
The code on the MCU needs to know what to expect or it is not going to know what to do with the data.
That is where arrays come in handy, but then you need to figure out what and where the data you want to use is located in the array.

I know, not a direct answer
Reread the section of the manual SERIN2 and the WAIT thing. Also find out what DEC2 or DEC3 does.