made precise have contracts and invariants and parse tweak