Added basic markov chain functions