implemented exercise 12