Added some contract checks

Mostly just adding contracts to the code.