Code from page 8 of the programming supplement.
