The world watched in horror Monday night while flames tore through the Notre Dame Cathedral in Paris. As fire consumed the roof and toppled its iconic central spire, it seemed as though the historic church could be lost forever – but it’s possible, thanks to cutting-edge imagining technology, that all hope may not be lost.

Thanks to the meticulous work of Vassar College’s art historian Andrew Tallon, every exquisite detail and mysterious clue to the building’s 13th-century construction was recorded in a digital archive in 2015 using laser imaging.

These records have revolutionized our understanding of how the spectacular building was built – and could provide a template for how Paris could rebuild.

According to Wired, “architects now hope that Tallon’s scans may provide a map for keeping on track whatever rebuilding will have to take place.”

In 2015, National Geographicprofiled Tallon and his unique scanning process, highlighting his digital imaging of the Notre Dame Cathedral.

For centuries, the only tools we had to measure medieval buildings and structures were primitive – strings and rulers, pencils and plumb bobs – but by turning to 21st-century technology, Tallon was able to tease out the secrets of this miraculous structure.

“If I had texts at every point, I could look in the texts and try to get back into the heads of the builders,” Tallon told Nat Geo. “I don’t have it, so it’s detective work for me.”

For his scans of Notre Dame, Tallon recorded data from more than 50 locations in and around the cathedral, resulting in a staggering one billion points of data.

Each scan begins by mounting the laser onto a tripod and placing in the center of the structure. The laser sweeps around the area in every direction, and as it hits a surface, the beam bounces back, recording the exact placement and surface of whatever buttress or column it landed on by measuring the time it took the beam to return.

Every measurement is recorded as a colored dot, combining together into a detailed picture, like the color pixels of a digital photograph.

Eventually those millions of dots form a three-dimensional snapshot of the cathedral, and the resulting images are meticulously precise; if the scan is done properly, Tallon told Nat Geo, it should be accurate within 5 millimeters.

According to The New York Times, it took less than an hour for the fire to spread from the attic of the cathedral and engulf the roof, toppling the central spire.

Support for the recovery efforts have begun pouring in, with wealthy Parisians and companies pledging more than US$450 million in donations to Notre Dame’s restoration.

Despite the extensive damage, the NYT reports that most of the priceless artifacts and the stone structure of the cathedral remain intact – though only time will tell how long it’ll take to restore the beloved structure to a semblance of its former glory.