Better handling when connecting and disconnecting for a pebble