add some comments to describe the invariants.