improve the test function