final version of thesis. still needs a few changes