Better handling of reconnection ... still needs more debugging