added exercise 40 with extra credit