implemented exercise 4