Updated problem 22 with method from problem 42.