Added more extensive logging.