Markov Chain template class