Almost done reworking the internals.

It's much more flexible now!