Created a Markov object, remove global vars, add functions.