Add function to search gadget from tree