New SEARCH_TEMPLATE script function