Added timeouts and improved logging.