Massive changes

The changes here are too large to really deal with. Things are broken a
bit still.