optimized template rendering