Working beam search.