Restructure template files