Finally have it working. Lots of hacks were needed, there's lots of work
left to do.