When and how much caffeine you ingest may impact its effectiveness.

By Sarah Gray
Updated June 06, 2018

Whether to counter a rough night of sleep, or provide an afternoon jolt, around 90% of Americans consume caffeine in some form every day, according to Villanova University.

However, when and how much caffeine you ingest may impact its effectiveness.

The U.S. Army Medical Research and Materiel Command’s Dr. Jaques Reifman is hoping to optimize caffeine intake for soldiers (and eventually the broader population) using an algorithm. His research was published on Monday in the peer-reviewed Journal of Sleep Research.

To account for different responses of individuals to caffeine, Reifman, who is also a senior researcher for the Department of Defense’s Biotechnology High Performance Computing Software Applications Institute, and his team administered around a dozen psychomotor vigilance task (PVT) tests to an unspecified number of people to help inform the algorithm, according to Quartz.

The researchers tested an algorithm by comparing the impact of dosing on subjects to the results in four “previously published experimental studies of sleep loss,” Science Daily explained. One comparison used the same amount of caffeine as the initial study but aimed to use the algorithm to improve the outcome of subjects on PVT tests, while the other used less caffeine and hoped to apply the algorithm to achieve the same performance rate as the initial study.

“We found that by using our algorithm, which determines when and how much caffeine a subject should consume, we can improve alertness by up to 64 percent, while consuming the same total amount of caffeine,” Reifman told Science Daily. “Alternatively, a subject can reduce caffeine consumption by up to 65 percent and still achieve equivalent improvements in alertness.”

According to Quartz, the algorithm is being “assessed” during some soldiers’ training, and the U.S. Army is planning on licensing the technology. This caffeine algorithm is not available for the broader population just yet. However, a less personalized 2B-Alert mobile app can be used by the public now.

This Story Originally Appeared On Fortune