Prototype of auto-reconnect functionality

PoC, totally untested yet