Partially solve chapter 5.