Initial commit

From work done Fri, May 23 2014

I really should have committed sooner. This script underwent several
changes while working on it that week, and I feel a bit guilty not
keeping track of those changes.