incomplete but working solution to exercise 2