Add rudimentary error handling and reconnection.