Added solution for exercise 5.