updated beam search