This is Alessio Pellegrini's MSc thesis.