Added asserts to document and verify assumptions.