Partly solve chapter 4