Added some code contracts to the library