better handling of connection - allows re-creation if connection dies