adding reconnection feature, still incomplete