Add connectivity error handling and minor bug fixes