Solution to Problem 34, needs documenting