Added debug logging.