added beam search