Marianne Gregory’s house is easy to find. It’s the only bright pink stucco one on a tree-lined block in Los Angeles. But the house wasn’t always this festive. Gregory and her husband bought it in 1971. She was a high school teacher, he wrote for a car magazine and it was what they could afford.

"The house looked like a haunted house when we bought it, and people thought we were crazy,” recalls Gregory.

She and her husband started fixing it up bit by bit. They took adult classes at night in the high school wood shop and built some of their own furniture. One day, Marianne came across an L.A. Times article about a church that was being torn down, so she showed up hoping to get one of the stained glass windows. She was nine months pregnant at the time. They told her, "Sure we’ll sell you one, but you have to go up there and find the window yourself."

“So I’m climbing up these long narrow stairs and thinking, 'Damn, I hope it’s sturdy'. And I found that one and we put it in and in the morning if you are downstairs its magnificent. It can almost give you religion,” says Gregory, standing in orange light from the window.

Today the house is beautiful. Over the years, they took out loans to make an addition, add a swimming pool and remodel parts of the house.

"And then I got a divorce in ’04, right around the time I retired," says Gregory. "And I bought my husband out and got a new 30 year mortgage, which I refinanced twice."

Now this is just one story about the life of a house, and about retiring with a mortgage balance. But it’s a story that’s increasingly common.

“The old rule was when you retire you really shouldn’t have a mortgage,” says Frank Stafford, a research scientist at the institute for social research.

He found that in the late '90s, 30 percent of people about to retire, those from 55-64 held a mortgage. By late 2009, it jumped to 50 percent, “so that was a pretty big shift,” says Stafford.

The biggest risk in retiring with a mortgage balance, Stafford says, is that retirees have less money for unforeseen expenses like medical bills or major car repairs.

"What happens is there is enough of these events that come along that end up reducing overall wealth accumulation, either in pensions or home equity, that’s needed to support a long retirement. Or even not such a long retirement.”

So what caused this big shift? Why are so many more taking cash out of their homes and extending theor mortgages? When I first started reporting this story, I thought it was historically low interest rates. And that is part of the explanation. But the other part surprised me. It has to do with the automation of underwriting.

"And certainly the mortgage giants Freddie Mac and Fannie Mae had a lot to do with that in terms of automating the process," says Gary Painter, professor at the Lusk Center for Real Estate at USC. He says Fannie and Freddie automated the underwriting process so they could take the mortgages they bought and bundle them. "And they wanted to have a very clean process form start to finish in terms of bundling those mortgages.”

The result was that it streamlined the process. There was a lot less paperwork.

"And as a result," adds Painter, “it really did reduce the cost for banks. And then mortgage brokers got involved in the industry as well because they could work with the client to refinance their mortgage and have Fannie Mae Freddie Mac or some other secondary market purchaser take the loans of their books.”

This was essentially a new product that lenders aggressively marketed to homeowners. And all this refinancing spurred on the economy. Banks now had this new stream of revenue, mortgage brokers had tons of business, and homeowners could lower their monthly payments. But they also used their house’s equity to buy a boat, take a vacation or pay off their kids tuition.

"And of course if you are taking cash out, you increase your mortgage balance and then you are more likely to have a mortgage balance later in life,” says Painter.

And that brings us back to retirement. We are starting to see the impact of the refinancing boom in older populations. People are working longer, into their 70s, and retirees are rethinking their long term plans.

Because for many, retirement now means a smaller safety net and years of mortgage payments.