Code I have written for my msc thesis