Tasks 2, 3 and 3b were solved in chapter 5