Added solution to exercise 2.24