This sends the state as it was before any of the changes made by the switch statement occurred. That looks wrong to me.

It also looks like this can send the same state multiple times, is that desirable?