Lots of cruft for tracking invariants