IMplemented automatic disconnection detection.