Added some contracts and tests