new approach to template switching