added markov chain functionality