Added support for reconnection