exercise 3 (parts 2-4)