This story originally featured on Popular Science.

When something goes seriously wrong with your laptop, you usually receive an advance warning. A virus might alter your security settings, for example, or a failing hard drive might start making funny noises. If you catch these signals early, you can quickly diagnose and fix your computer.

Many of our recommended solutions involve a thorough malware scan. If you haven’t already installed antivirus and antimalware programs on your system, do that now. You can rely on the build-in Windows or macOS programs, or go shopping for another security suite. Just make sure to put in the research: Check out an online buying guide for Windows or macOS, read up on user and professional reviews, and find the right set of tools for your needs. Don’t let price deter you—solid computer security is worth the money.

[Related: The best laptops for photo editing.]

In addition to your primary suite, consider getting a second opinion. You can employ a less-intensive scanner, one that requires you to install fewer files, alongside your main one. Instead of running regular checks, the secondary program would work on an on-demand basis: You only need to fire it up when you need it. We like Microsoft Safety Scanner for Windows and Malwarebytes for macOS.

With so many computer systems out there, problems may manifest differently on each type of machine. But by the time you’ve finished reading this guide, you should have a much better sense of what various issues look like. And the earlier you spot them, the earlier you can fix them.

1. Sluggish and unresponsive performance

If your laptop begins slowing down, this doesn’t necessarily mean it’s caught a virus. However, sluggish performance can be a tell-tale sign that a hacker has hijacked your machine for secret activities such as sending spam or mining for cryptocurrencies.

Start with a thorough malware scan. Then check the programs that may be running in the background. On Windows, open the Task Manager (to find it, search for the program’s name via the taskbar), and on macOS, the Activity Monitor (search for it in Spotlight). You’ll see a list of currently-active programs, including some familiar names and some strange ones. Don’t expect to recognize everything here—active processes you haven’t seen before aren’t necessarily bad. Just try searching for those processes online to learn more about them.

If a malware scan comes up blank, and you can’t find anything suspicious in the list of running applications, the culprit may be a non-malicious buggy program. Try shutting down your open windows one by one and then restarting those programs. Or, if you notice that one of the active programs in the list is using up a lot of memory, you can try uninstalling it.

The slow performance may simply be a symptom of your laptop’s age. But all is not lost: We have tips for speeding up old computers, whether they’re Windows or macOS.

2. Persistent error messages

All computers get the occasional error message. It’s when you start seeing these alerts regularly, over and over again, that you should start to worry.

Because the culprit could be anything from failing hardware to a virus to a corrupted program installation, you’ll need to put in some detective work to discover the root cause of the messages. Start with the text of the error message and any codes it includes. Then go online and type that information into your favorite search engine. You should find some pointers on what’s going wrong and how you might be able to fix it.

If your results indicate that errors are related to one specific program, then you have a relatively easy fix: Uninstalling and reinstalling that application is one of the most effective ways to make everything run smoothly again.

[Related: Can an iPad Pro replace your laptop?]

You can’t diagnose every issue this easily. When you’re receiving shorter error messages, the text may turn up fewer search results, which can make them harder to troubleshoot. For more information, look at the message’s timing. When viruses and malware are causing issues, for example, they often trigger errors that appear when your computer is booting up or shutting down, or when you’re trying to configure your security programs. Alternatively, if you tend to see messages while you’re attaching a Bluetooth keyboard or another peripheral device, that gadget’s outdated software may be to blame. Check online to see if you can find updates for the device.

If your online sleuthing can’t uncover the culprit, try running through the most comprehensive virus scan you can. As a last resort, back up all of your applications and files and then reinstall Windows or macOS. This should fix most error messages—unless they’re related to failing hardware. In that case, you may have no choice but to buy a new machine.

3. Unrequested changes to settings

If your applications start behaving strangely or reconfigure their settings without your permission, your machine has probably caught a virus. After gaining access to your system, malware will often alter your settings for its own purposes, such as preventing you from removing it.

Often, you’ll first notice these changes in your browser. The infection might disable certain features, change your homepage, or reset your default search engine. Sometimes, new extensions that want to push their own services, rather than viruses, will alter your browser settings. You can check by uninstalling any recent extensions.

Also watch out for other suspicious changes: New icons, which you didn’t ask for, may appear on your desktop, or an invisible hand might reconfigure your security programs. Viruses can trigger a wide variety of different changes, so keep an eye on your applications and don’t ignore major modifications to your software setup.

As we’ve mentioned before, this activity might be innocent—programs reconfigure your system all the time in order to work properly. Just be wary of changes that seem to happen without warning or that involve your browser or security applications.

To fight a potential infection, first roll back the changes—for example, set your browser’s homepage back to its original location. Then run a full virus and malware scan on your system. If you find out that a legitimate program or browser add-on is the one that keeps making changes, you can uninstall it.

4. Random web pop-ups

Everyone has to deal with pop-ups while browsing online. But if you’re seeing more than normal—and they’re pushing suspicious content rather than prodding you to sign up for a newsletter—then you might have a problem. What sort of pop-up content should set off alarm bells? Look out for messages that claim you’ve won a competition or a reward, flash a malware alert, or nag you to play games, especially if they also make it difficult for you to return to the original page. These can signal that a browser extension is behaving badly or that some kind of malware has taken root on your machine.

To fight the intrusions, first find a list of browser extensions you’ve installed. In Chrome, for example, they sit under the More tools entry on the main app menu (open it by clicking the three vertical dots on the top right). In Firefox, they’re behind the Add-ons entry in the main app menu (launched via the three horizontal lines on the top right). In Safari, access them through Preferences on the Safari menu. Finally, in Microsoft Edge, open the main app menu (the three dots on the top right) and choose Extensions.

Next, uninstall as many of these add-ons as you can, stripping your browser down to the bare minimum to see if this fixes the problem. If that doesn’t tame the pop-up epidemic, try uninstalling and reinstalling the browser. In addition, as always, run a thorough virus and malware scan to see if something outside your browser is causing issues.

5. Strange noises

As a computer’s internal components begin to wear out, it can grow too old to function properly. Refusal to switch on is a sure sign of hardware issues. But you should also keep an ear out for strange and repeated noises coming from the depths of your laptop, because these can indicate that hardware failure is imminent.

When you hear these sounds, immediately save your data to an external machine or a cloud service. (This task will be easier if you’re already backing up your files on a regular basis, a habit that everyone should cultivate.) Even if the noises prove to be inconsequential, it never hurts to back up your data. And in a worst-case scenario, an archive of this information will preserve your digital memories and ease the process of switching to a new computer.

[Related: What strange noises mean for your machine.]

Once you know your files are safe, you can start figuring out just what the problem might be. Consider your laptop’s age: The older it is, the more likely hardware failure is to blame. Have you ever dropped your machine or spilled a hot drink on it? Accidents like these can speed up a computer’s aging process. If your machine is relatively new, a foreign object could be gunking up the works. Try cleaning out your laptop’s sockets and ports with a small can of compressed air to make sure it’s not carrying some small, easily dislodgeable item.

If the weird noises persist, run a systems diagnostics program to figure out whether your laptop really is on its last legs. For example, software like CrystalDiskInfo for Windows (free) and DriveDx for macOS ($20 with a free trial) can report on the health of your hard drive. And if an internal component is on its last legs, it may cause other symptoms such as overheating, random crashes, and particularly slow performance.

Unfortunately, if a part of your laptop is failing, you can’t do too much about it at home. So go to the experts: Visit your local computer repair shop to see if they can replace the component. Or, depending on your computer’s age, you may want to invest in a new laptop instead of trying to resuscitate an old machine.