More invariants + cleanup.