Improved template replacement to take advantage of calculted indexes
Use a safer date sniffing
Removed the warning for the $name variable