Fix retry logic. Remove extraneous newlines in logging.