Many comforting bean dishes, including French cassoulet and even classic American baked beans, owe much of their appeal to a push-and-pull of contrasting textures: bottom-of-the-pot beans that become creamy-tender and a top layer that crisps and caramelizes, all of it thanks to low-and-slow cooking.

It’s the slow part we wanted to remedy as we considered the best way to make another such dish: Macedonian tavče gravče (literally, “beans in a pan”), a rustic casserole of white beans. We wanted a solution that delivered creamy richness and a caramelized top without long, slow cooking.

We found it, somewhat unexpectedly, by cracking a can. But first, we had to sort out which bean was best.

Traditional tavče gravče calls for dried tetovac beans, named after the Macedonian city of Tetovo. These large white beans are baked for hours with onions, garlic, peppers and paprika. As the national dish, tavče gravče plays many roles. A vegetarian version is often served on Fridays or for Lent. But it just as easily transforms into a meaty celebration meal.

Prized for their creamy and toothsome texture, tetovac beans hold their shape well during extended cooking. Unfortunately, they are difficult to find in the U.S.

Cannellini beans often are suggested as substitutes, but they performed poorly in our tests. The smaller, thin-skinned white beans tended to dissolve into mealy mush when braised. And canned cannellinis varied widely in quality across brands.

Instead, we found a solution in canned butter beans—a large, meaty variety known for its creamy yet robust texture. They not only saved us time compared to dried beans, but they could withstand the cooking needed to get the crisping we wanted on top. Even the beans’ canning liquid played a part.

Tavče gravče typically relies on lengthy cooking to draw starches out of the beans, which combine with the liquids and juices in the dish to create an even creamier consistency. Those starches also help protect the beans during cooking, keeping them intact. But canned beans come packed in super-starchy liquid, and adding some of it to the dish meant we had all the starch we needed, minus the lengthy cooking time.

Since the meats and vegetables shed moisture, it was also important to make sure the bean mixture reduced properly in the oven to achieve the signature crispy top.

So choosing the right cooking vessel was vital. Overly narrow or tall pots impede evaporation, preventing steam from escaping and hindering caramelization. Instead, we opted for a Dutch oven with a wider diameter (ideally between 11 and 12 inches), which promoted browning and the development of deeper flavors.

Luckily, the dish is also remarkably forgiving. If that crispy top proves elusive, the problem of overly watery beans is remedied simply by extending the cooking time in the oven.

The finished dish can be served straight from the pot, as the Macedonians do, with a side of crusty bread for sopping up the delicious sauce.