some cleanups areound the Invariant code
some C++ style cleanups
more C++ style cleanups