Connection and disconnection are working correctly

I've also made a few other tweaks as I went along, but nothing really
major.