Code for my masters thesis