British consulting firm Cambridge Analytica got its hands on detailed personal information from 50 million people because 270,000 Facebook friends gave away access to their own data by answering a silly quiz app. Cambridge then used info collected from the “ThisIsYourDigitalLife” quiz to create ads and messages targeting voters for the Donald Trump 2016 presidential election campaign. The most stunning news for many users may be that Facebook not only permits but encourages developers to collect data.

The social media giant opened its doors to broad data collection back in 2007 so that outside developers could build apps and programs on top of Facebook’s open platform. Today third party apps mine tons of detailed personal data on Facebook’s 1.86 billion users every day. The info can include users’ ages, locations, groups they belong to and pages they’ve liked.

Facebook does prohibit selling or giving away data collected by a third party. It was Cambridge University professor Aleksandr Kogan who developed the “ThisIsYourDigitalLife” app and gave the collected data to Cambridge Analytica.

There are steps social media users can take to protect the safety and security of their personal information. You do have some control over where your data lands. Start by thinking about what you are doing on Facebook. Before you reveal any data, consider why you are handing over personal information.

“You should ask yourself, ‘Do I know what people are going to do with my data?’” said Russ Schrader, executive director of the National Cyber Security Alliance. Schrader says the advice he offers may not be foolproof, but it can go a long way to protect your data from being used without your consent.

Question why you’re giving certain information. “If you’re taking an online quiz, that quiz doesn’t need to know your address and phone number. Be careful if you feel (uncomfortable) disclosing info to certain questions. Vendors can be putting together a profile on you based on the info you give.”

Find your online comfort level. “Set your privacy settings to a comfort level good for you. Urge people to really think about it deeply.”

Share with care. “What you put on the web can last a lifetime,” he said. “Before posting about yourself with others, think about how it will be perceived now and in the future.”

Clean House. “The same way you spring clean your house, the same needs to be done for your computer. Look at all your apps and ask what are they trying to find out about you. Get rid of the apps you aren’t using.”

Secure devices. “Use facial recognition or long pass phrases instead of passwords,” he said. “Passwords with special characters are hard to crack, but also hard to remember. Longer phrases are better, like ‘Mary had a little lamb.’ Find a pass phrase that is something long that you’ll remember and will be difficult to replicate.”

Adopt two-step verification. “Your most important sites, like banking and health apps, should have a code or fingerprint after the pass codes.”

Read More: How Facebook’s Data Sharing Went from Feature to Bug