Added contracts for some classes.
Added contracts for Matrix.
Added some contracts.