template resolution improvements