Simplified test conditions
Fixed test.
Removed debug code