Added Markov Chaining functionality