More work on the Markov Chain
Some renaming and restructuring
Cleaning up code