rearrange; add contracts; improve contracts