Correct invariants
Small refactoring