adding beam search, need to fix particle filtering