Recursive template sanitization added