Refactor test-script