Added sm.pdf, a thesis chapter explaining in some more detail the model in the example code.