Cleanup

main change is to exceptions, the rest is renaming and such.

Easier to check each commit.