More logging and thread protection