When your infant is crying and you want to offer her comfort, swaddling her can be a great way to help her feel safe and secure.

Although wrapping a baby tightly in a blanket or cloth dates back to ancient times, the last few years have seen the practice become somewhat controversial. In 2011, the National Resource Center on Child Health and Safety, a Colorado-based organization that provides health and safety guidelines to childcare centers, issued a recommendation against swaddling. This led to childcare centers in Minnesota banning swaddling and some centers in other states discouraging the practice. They were concerned about the potential risks, such as the baby overheating, and the dangers associated with placing a swaddled baby on its stomach, which can increase the risk of sudden infant death syndrome (SIDS).

Related: 5 Dangerous Baby Products to Avoid

But the American Academy of Pediatrics (AAP) says swaddling mimics being in the mother’s womb and, when done correctly, is an effective technique to help calm infants and promote sleep.

So how do you make sure you’re swaddling your baby correctly? Laura Tichler, a New York-based certified childbirth educator and postpartum doula, offers the following tips to safely wrap your baby like a burrito.

1. Use a lightweight blanket. Tichler recommends using swaddle blankets that are made of lightweight, gauzy cotton.You want a material that’s breathable so your baby doesn’t get too warm,” she says.

Don’t place your baby in thick flannel pajamas and then swaddle him. He might get too warm. Instead, clad him in a light garment such as a cotton onesie before swaddling.

A baby’s hands, feet, tummy, chest and back should be warm and dry. A sweaty neck and back is a sign that your baby is overheating and should be dressed in lighter-weight clothing.

Related: How to Choose a Pediatrician

2. Use the proper technique. When you swaddle your baby, you want the blanket to be tight enough for the baby to feel secure. Since seeing how to swaddle is the best way to learn it, check out this step-by-step video. 

It may take a few tries before you master the swaddling technique. “The most common mistake new parents make is they swaddle their baby too loose,” Tichler says. If you swaddle too loose, your baby make break free of the blanket. To ensure you have a good fit, slide your hand between the baby’s blanket and chest — it should feel as if you’ve put your hand in your waistband. And remember: Always place a swaddled baby on his back, not his stomach or side, when he goes to sleep.

3. Use swaddling wisely. “Babies need time to move around and to kick their legs and arms,” Tichler says. “There’s a danger in spending too much time swaddled as parents can also miss hunger cues from their baby.”

Tichler recommends swaddling your baby only when she needs to be soothed, and when you’ve ruled out that she wants to be fed, held or needs a diaper change.

Until they’re about three months old, babies have a startle reflex that causes them to flail their arms and legs and wake themselves up. Swaddling helps to reduce awakenings caused by the startle reflex.

“The purpose of swaddling is to induce sleep and provide comfort to a fussy baby,” Tichler says. “When your baby is awake, they should be allowed to move around, rather than spending all day swaddled.”

Related: How to Know if Used Baby Gear is Safe

4. Adhere to swaddling age guidelines. Although the right age to wean a baby off swaddling varies from child to child, Tichler says that most babies can start breaking free of swaddling blankets around two months, when they start to roll over. “This is a good time to transition to a sleep sack, which is a wearable baby blanket,” she says.

5. Keep your baby’s hips loose. In 2011, the National Resource Center expressed concerns that babies who are swaddled too tightly might develop problems in their hips. To prevent this, the Pediatric Orthopaedic Society of North America and the AAP Section on Orthopaedics both recommend “hip-healthy swaddling” that allows a baby’s legs to move up and out.

Related: Keeping Bath Time Safe for Kids

Linda Childers is a mom, pet-owner and California-based health writer.