Working old blog post into discrete code chunks.