A man survived more than three weeks in the freezing Alaska wilderness when state troopers found his “SOS” message that he scrawled in the snow, authorities said.

Authorities found Tyson Steele, 30, a homesteader from Salt Lake City, Utah, safe and sound last Thursday after he fled his remote cabin, which caught fire in mid-December, Alaska State Troopers said, according to the New York Post.

Steele was safe, but he was hungry, cold, and looked like the Tom Hanks character in the movie Cast Away when the troopers found him.

Steele’s cabin was completely destroyed by the inferno, which began when a “big piece of cardboard” he burnt on the woodstove set the roof ablaze on December 17 or 18.

The 30-year-old’s dog, Phil, did not survive the fire, and most of his possessions also perished in the blaze as well. Authorities say Steele lived alone in the cabin 20 miles from Skwenta.

Steele, who did not have a phone or map to guide him, survived by spending two days hunkered down in a snow cave.

“It was just big enough for my sleeping bags and me and a couple things of food,” he said in a press release about the rescue. “And that stayed, you know, snow caves are pretty nice for survival. There’s a lot of insulation. It can be negative 40 outside and if you have a candle—which I didn’t— but if you do, it can be above 30 degrees.”

“But I just huddled into that dark cave and I slept. I slept for a really long time. And it was, it was warm. Warmer than outside,” he continued.

Steele then used the remains of his cabin to build a temporary shelter and kept a perpetual fire going for warmth.

He was also able to survive on 30 days’ rations of food that he was able to salvage from the cabin, according to Steele’s account of the ordeal.

Troopers began searching for Steele on Thursday after friends said they had heard nothing from him.

When authorities flew over the area, they found Steele’s “SOS” sign and spotted him waving his arms in need of help.

After his rescue, Steele’s friends gave him a hot shower and a McDonald’s Combo Meal number two.

As for Steele, he says he is going back to Salt Lake City to recover for a while.

“I’m probably going to go back home to Salt Lake City. Not ‘back’ home, because this is my home,” he said of the Alaska wilderness. “But to my family. They’ve got a dog. And that would be some therapy.”