Rewrote markov to use integer weights