refactor test script