Correct test logic
Correct factoring function