Code for my bachelor project