intermedia step. refactored code without lookahead. variational SMC