Starting your day off with a cup of coffee is a nearly universal American experience. A piping hot cup of caffeinated crude can help you shake off the cobwebs of a long (or short) night’s sleep and serve as an important part of your morning ritual, but for those that have stood 24 hour posts or been in dangerous situations where staying awake and alert was integral for survival, coffee begins to assume a different role in your brain. In the field, coffee isn’t a relaxing way to start your day, it’s one of a slew of tools you use to keep your eyes open and brain functioning until the opportunity for sleep presents itself.

My Marines and I would sometimes skip the water all together, pouring the Folgers Choice instant coffee from our MREs directly into the space between our teeth and lips like chewing tobacco. Admittedly, chew did a better job of keeping you up, but the drugs that help keep you conscious all come with a physical price: too much nicotine would make you feel terrible, too much caffeine could do the same, and the more you used either, the less effective they became as a tool in the long run.

Caffeine intake, it will come as no surprise, is more than just a cultural touchstone for service members, for most of us, it was an integral part of the job — and it was with that in mind that the U.S. Army recently set about spending tax payer’s dollars on finding ways to maximize the beneficial effect of coffee while minimizing an individual’s required intake. In short, the Army wants each soldier to get the most bang for their (mg of caffeine) buck, and according to their findings, that all has to do with the timing of consumption.

“We developed algorithms that work together, and they essentially allow us to determine, at the individual level, when and how much the individual should take caffeine to achieve peak performance at the desired time, for the desired duration,” said study senior author Jaques Reifman, director of the DoD Biotechnology High Performance Computing Software Applications Institute at the U.S. Army Medical Research and Materiel Command in Fort Detrick, Maryland.