Refactored Contract assertions to remove duplication.