Added some code contract validations and enabled code analysis