some tweakings in the connection, added exponential reconnect