Update the method of matching template