Half finished version of chapter 4