Restructuring of templating stuff