Yes, finite state machine. And no if you look at the midi specification program change only takes one value, I do not know why it needs to be in the second spot...
thanks for the plug Supper Matt! if your not up to the challenge of building a FSM then get my kit I have new Videos up on my new channel at youtube just look for TwoCherriesIns... on the encoder I use the interrupts so check them out in the learning section. http://twocherriesinstruments.ecrater.com/