fixes and code cleanup in stochastic module
Merge pull request #230 from jrjohansson/stochastic-updates

fixes and code cleanup in stochastic module