Implementation of 2.3.A in the book.
Briefly tested, but could use more.
Could likely use more edge-case protection.