Added error handling and comments to ServiceDiscoveryThread. Assorted logging.