Final version of my phd thesis