Code that I wrote for my thesis.