applying the generic search algorithm