PORTLAND, Ore. — We've seen the images of destruction following a major earthquake. These images often include crumbled and collapsed buildings right alongside structures that look almost untouched.

So why do some buildings fail while others stay standing? It comes down to engineering and technology.

Take, for example, Pioneer Courthouse in downtown Portland. When it was built back in 1875, it was not built to survive any sort of major seismic event.

But in 2004, the federal government spent $92 million on a project that included making sure it could withstand a large quake.

RELATED: Gas shut-off valve could save your home from catching fire when an earthquake hits

To see what changes were made, KGW took a tour inside the historic building, down the first elevator installed in the Pacific Northwest, into the basement and then down again into an area that had been excavated.

That's where engineers installed what's called a "base isolation" system underneath the building. There are 70 base isolation mechanisms in the building.

"The bottom portion of it is concave and the upper portion is convex, and there's a bearing in the middle," said Dave Mery, operations manager with General Services Administration. "And when the bottom starts moving violently with the earth, the upper portion will move less so, protecting the building."

In the event of an earthquake the building will sway gently back and forth, kind of like a pendulum.

It's an example of a seismic retrofit: taking an existing building, installing some technology, and giving it a much better chance to stay upright during an earthquake.

A few blocks away, at the new Multnomah County Courthouse, you'll find a different kind of quake-softening system.

RELATED: A look inside the newly built Multnomah Courthouse

"We have these steel braces which are distributed throughout the building and at the end of those braces are fluid viscous dampers," said Reid Zimmerman, a structural engineer at KPFF Consulting Engineers.

The dampers work a lot like the shock absorbers in the front strut of your car, like when you drive over a pot hole or a big bump in the road and you feel more of a cushioned jolt. The same thing is happening inside the building, just with much larger mechanisms to cushion a much larger jolt.

And 80 of the dampers are spread across the building. So when the ground below it starts shaking, the damping system absorbs a lot of that shaking and the building stays intact. 

"That pulse is translating up the building, and as its translating up the building it's basically being flattened out, squashed out, by the damping provided by the fluid viscous dampers," Zimmerman explained.

While this technology has been used to seismically retrofit existing buildings, this was the first in Oregon is was use for a new building.

It's a coupling of modern engineering with both new construction and some old, preserving history and helping to save lives.

RELATED: Are you really ready for the big earthquake?