Problem 30, and framework for problem 59