More cleanup/formatting/invariants/instancetypes etc.