Document a lot more and fix some bugs. Still largely untested.