Better handling of connect / disconnect