chapter 6, excercise 2 and 3
also improvement of excercise 1