Added support for disconnectig and reconnecting