Some cleanup and support for 0.9.0.

Needs some more cleanup, but at least it compiles. It has some breaking changes.