Refactored tests
Refactored tests. Fixed bug