Moved the test logic into the general case