simplified and improved markov chain generation