Problem 30. Possibly not exhaustively correct, but oh well.