Solution to #8.