Initial refactoring of Markov model
Made output a bit prettier