added solution to exercise 6