this is a working version of simple markov
adding pthread in progress