Exercises 2,3,4 of student-dir