Sorting The Templates