Added a bunch of code contracts
Simplified few CC