Added logging util and fixed few bugs with stochastic transitions