Factored more disconnect logic into DisconnectListener.