implemented exercise 2