Made the beam search easier to read.
Fixed a nasty bug which fetched the wrong trigram probability.