Fix test script
Refactoring tests