Pull request

Should fix (among many other things) #16, #23 ...

In particular, ceae868 , c3becff , and 7668943 fixed some nasty bugs.  ce2c2ba is a big overhaul of the switch system.  5e8bd08 , 5a077ef, 5b14628 all make cm_queue_flush work as expected.  60e4071 adds unique ID functionality.