added more diagnostic logging.