Code for Master Thesis