Tweaks for $template logic