Added most of the rest of the functionality.

It’s not quite working yet, but I should be able to knock out these
last few bugs soon.