Moved functions used in Problem 11 into a class