First version of chapter 2 with nearly all implemented.