Initial commit of code that works for me.
At this point I don't intend for this code to be easily-applicable to
other people, esp. people outside my research group.