end page template calling improvement