Optimize lastScantime() method.
Prevent repeated string expansion in often called templates.

Try to eliminate repeated reads of template variables.