Moved some macros into BaseInvariant, and some member variables down to facilitate readability