Fixing breaks in genes with speed and perfection can be a matter of life and death for most organisms. Even the simplest changes in a sequence risk catastrophe, especially if the altered code is responsible for a critical function.

Over the past half a century, biologists have studied the mechanisms involved to piece together most of the major steps involved in making faithful repairs in DNA. Yet, one part of the process has remained frustratingly unclear.

By marking key enzymes and DNA with fluorescent tags and watching the repair process unfold in real-time in an Escherichia coli model, researchers from Uppsala University in Sweden have filled in missing details on how bacteria find the templates they rely on to keep genetic repairs error-free.

One trick most living things use to keep their code in order is the process of homologous recombination, the biological equivalent of comparing two distinct versions of a script to make sure a copy hasn't mistakenly introduced any errors.

By holding up a non-damaged version of a sequence next to a repair job, a cell can ensure no changes occurred when the severed ends were glued together.

Molecular biologists have known for a while that the recombinase protein RecA plays a key role in managing this process. It's such an important enzyme in maintaining the integrity of DNA that some version of it has been found in virtually every species studied.

When a double-stranded 'ladder' of DNA snaps completely, a complex of proteins gets to work grabbing ahold of the severed ends and trimming it neatly so RecA can settle in and do its job.

This involves the protein extending into a long cluster, forming a filament of protein and nucleic acid that is capable of holding onto both the broken strand and a second, intact ladder of unbroken DNA.

This much scientists know. From there, the filament needs to find the right sequence to serve as a point of comparison. How the filament manages this search in a sufficiently short time has been a mystery for the better part of 50 years, one compounded by the millions of base pairs to be checked amid the complex twists and turns of the chromosome.

To better understand the timing and navigation of the enzyme at work, researchers grew thousands of E.coli cells inside a series of tiny channels that allowed them to keep track of individual bacteria as they were experimented upon.

With the cells in place, the scientists made precise breaks in their DNA using CRISPR gene editing, labeling the severed ends with fluorescent markers to visualize the break's location under a microscope.

"The microfluidic culture chip allows us to follow the fate of thousands of individual bacteria simultaneously and to control CRISPR-induced DNA breaks in time," says Uppsala University molecular biologist Jakub Wiktor.

Lastly, they used antibodies to identify the location of RecA filaments as they settled into place and went about their library search.

A chemical alert told the team when the entire repair process was complete. On average, it took just 15 minutes for the E. coli to finish the job.

Surprisingly, it typically took just nine of those minutes for the protein to find the right template.

The secret seems to be in the construction of RecA's nucleoprotein filament. This thread stretches out across the cell, grabbing hold of the chromosome and sliding down in search of a match to the sequence in its grasp.

While this might not sound all that efficient, it's really no different than methodically walking up and down the aisles of a library in search of a book that matches the call number from the catalog.

"Since the DNA ends are incorporated into this fiber, it is sufficient that any part of the filament finds the precious template, and thus the search is theoretically reduced from three to two dimensions," says Arvid GynnÄ.

"Our model suggests that this is the key to fast and successful homology repair."

While this research was conducted on bacteria, the fact RecA is so similar throughout the biosphere makes it relevant to our own bodies.

Now that we know how the process works, we can start to look for signs of situations where repairing our own DNA goes wrong, opening the way to understanding the origins of diseases like cancer.

This research was published in Nature.