Fixed the messages serialization/deserialization
Unit tests
Trivial unit test for the switch code
Comments and docs
Not really needed: we will use the facilities provide by memberlist
Minor: format
Code cleanup
Minor: some reorganization