Rewrite done. A few dynamic uglynesses remain to be cleaned up, but
the client is working as intended.