added stochastic beam search