more template optimizations