Invariant

Please take a look
Yes, that should pass.  Added a test case.