Added reconnect functionality