Lots more changes and tweaks. Half way through rewriting the NetworkManager.