Extract common search procedure