Manual reconnect

refactored out of #2.