Reworked patchTemplateForensics.php