Scientists in Wales have helped develop a technique to streamline production of new drugs to detect if they could become ineffective or even harmful.
Researchers can now spot if molecules could be unable to bind to proteins or enzymes in the body as intended.
Compounds can become mirror images of themselves, known as racemisation, rendering them unable to work properly.
Dr Niek Buurma, of Cardiff University, said it would make the development of safe new drugs more efficient.
This is because molecules that are likely dead ends in development can be identified early.
The work, published in chemistry journal Angewandte Chemie, was done in conjunction with colleagues at Liverpool John Moores University.
Researchers developed an algorithm to test whether chemical compounds in drugs at the development stage were likely to undergo racemisation and how quickly it could happen.
Dr Buurma, the lead author of the study, said: "We believe that this risk-assessment will make it possible to manufacture safer medication by helping the pharmaceutical industry to quickly spot medication that will fail during development and focus their efforts on compounds that are more likely to work."
Scientists describe them as being left handed or right handed - while they look the same in terms of structure, they are in fact mirror images of one another.
Such compounds are known as enantiomers - if the pharmaceutically-effective enantiomer becomes its mirror image, this can prevent certain drugs from binding in people's bodies.
Instead of having the desired effect, drugs can become less potent or, in some cases, have an adverse effect.
One such case was when German company Chemie Grunenthal developed thalidomide, a drug given to pregnant women to treat morning sickness.
While it worked as a sedative, one of these mirror images of the chemical compound caused birth defects and it became an international scandal.
This process Cardiff University scientists have helped to develop can be applied to any drug being developed.
Dr Buurma said: "It's absolutely amazing to be here because when we first started this project we promised that this is what we were going to be able to predict."