Updated test function