Code for my PhD thesis