Simplified test code to reduce spurious test failures.