Adding markov function