added chain to markov
updated with m and nth order
fixing bugs in markov chains