refactored assertion functions