Prog Exercise 8 solved