refactored inverse testing