template optimizations