working on reconnection logic