Proper food storage is the best way to make the most of your grocery budget and maintain the quality and freshness of your food for tastier meals.

There are quite a few misconceptions about how and where certain items should be stored, and during this time of year when temperatures and bug populations are on the rise it’s even more important to protect your food. After all, attracting insects and cultivating mold could have repercussions that affect a lot more of your home than just the kitchen! Try following these instructions for storing some common food items after your next trip to the grocery store for a happier, healthier home:

Flours: Almost everyone I know has at least two kinds of flour stored in their pantry, but the majority of flours should actually be stored in your refrigerator or freezer. Refined flours, such as all-purpose white flour, can keep their pantry location because the way they’re processed make them less susceptible to spoiling, and in an airtight container they should last one to two years. Most other flours, including whole grain flour like wheat and nut flours like almond, contain a significant amount of oil and therefore have a much higher risk of spoiling after you open them. These types of flours are best kept in an airtight container in the freezer for up to a year, but if your freezer is short on space the refrigerator is a suitable substitute and will keep these flours safe to eat for up to six months.

Grains: Popular grains such as oats, quinoa and white rice are safe to keep in a cabinet or pantry and often keep for years, but if they don’t come in a resealable package you should still put them in a freezer bag or storage container. Brown rice, on the other hand, is similar to brown flour and should also be kept in the refrigerator or freezer for up to six months.

Legumes & Pasta: Unless you’re storing these as cooked leftovers, legumes and pasta should never be refrigerated because they will absorb the moisture in the air. If you’re running out of room in your pantry, colorful beans or interestingly shaped pastas can double as kitchen décor during their one to two year shelf life if you seal them in a glass jar and display them on your counter.

Sugar: Sugars are ideal cabinet dwellers because they also easily absorb moisture, which you may have realized if you’ve ever tried to chip away at a bag of hardened brown sugar while baking cookies. Storing sugars in resealable containers instead of their original bags will help minimize moisture retention, and if you opt for a container that doesn’t have a metal clasp you can pop it in the microwave to soften clumps.

Cereal: If you go through cereal quickly, within a few days or a week of opening it, it will be perfectly fine in its box on a pantry shelf. To extend the shelf life, if you purchase in large quantities or don’t eat it every day, move it from its original package to a cereal container or store it in the refrigerator during seasons of high humidity to keep it fresh.

Coffee: This one might rock your caffeine world – do not keep coffee in the refrigerator or freezer! I know so many people who do this to maintain freshness, but it actually has the opposite effect. Moisture has a tendency to invade refrigerated and frozen foods, as we’ve discussed, and it will compromise the flavor of your coffee. Unopened coffee can last for up to a year, but after opening you should consume it within one to two weeks to get the most bang for your brew.