Pieces of code used in my thesis