Add markov model code