Improved test script