Added proper test handling