Solution to #9.