exercise 2 implemented