Remove some dead code.
Reconnection improvements and more tests.