Code contracts
Fixed analysis issues