Companion code for a series from my blog.