Restructing template files