a working version of simple markov with thread