Solution to #6.