Made the test more robust
Refactoring
Reduced the amount of duplicated code substantially