How Do I better this search and search again code in a treeview

How Do I better this search and search again code in a treeview:

function TForm1.FindNode(TreeView: TTreeView; S: String; SearchAgain: Boolean): TTreeNode;
var
  Node: TTreeNode;
begin
  if (SearchAgain) then
  Node:= TreeView.TopItem
  else
  begin
    if TreeView.Selected <> nil then
    Node:= TreeView.Selected.GetNext
    else
    Node:= TreeView.TopItem;
  end;
  Result := node;
  while Result <> nil do
  begin
    if AnsiCompareText( S, Result.Text ) = 0 Then
    begin
      TreeView.SetFocus;
      Result.Selected:= True;
      Result.Focused:= True;
      Result.MakeVisible;
      Exit; // found node
    end;
    Result := Result.getNext;
    if Result = nil then
    begin
      Application.MessageBox('Nenhuma ocorrncia encontrada !', 'Informa??o', MB_OK +
                             MB_ICONINFORMATION);
      Exit;
    end;
  end;
end;