Adjustments to template logic