The formatting of the code sections in my last message got screwed up somehow. An easier-to-read version of this code may be seen in this gist: https://gist.github.com/kynnjo/146f202a4e7f85b62a4b kj