At 1:30 AM, the animal shelter’s doorbell rings, and the staff recognizes a familiar face.

Meet Bailey — a very smart dog who knows exactly where to go when the going gets rough.

Up until recently, Bailey had been living at the Animal Rescue League of El Paso, Texas. There, she won the hearts of staff and volunteers — delighting them with her sweet and loving personality. Finding a family, however, would prove a bit more difficult.

Bailey had the unenviable distinction as the shelter’s longest-serving resident. But a month ago, that all changed.

She finally got adopted — but it wouldn’t be the last time Bailey’s friends at the shelter would see her.

After about a month with her new owner, the unthinkable happened. In a moment of confusion while testing a new harness, Bailey was spooked by something and ran. Her owner just couldn’t keep up.

“She got out of his sight,” Loretta Hyde, founder of the Animal Rescue League, told The Dodo. “He let us know that Bailey was loose, so we asked for people to be on the lookout.”

Bailey had gone missing — but as it just so happens, she wasn’t entirely lost.

Over the following days, reports of Bailey sightings began to trickle in — each one closer and closer to the shelter, about 10 miles from where she’d disappeared.

“For whatever reason, it felt to me that she was on her way here,” Hyde said. “I said, ‘She’s coming back to the shelter.’”

And sure enough, Hyde was right. At around 1:30 in the morning, days after Bailey went missing, staff got an alert from the shelter’s doorbell camera that someone was standing outside.

“[Our staffer] looked and thought, ‘Is that Bailey?’” Hyde said. “You can talk through the doorbell camera, so she hollered, ‘Bailey?’ Then the dog looked at the camera, like, ‘Yeah, it’s me! Let me in!’”

The staffer then drove to the shelter where Bailey stood waiting and did just that.

Bailey had rescued herself.

With that, Bailey is finally back where she belongs, in the loving company of her dad. The whole experience has made one thing clear, however — Bailey still holds a big place in her heart for all the people at the shelter who brought her an him together.

“They’re welcome to come visit anytime. Bailey’s dad appreciates us, and we appreciate him,” Hyde said. “They will be back to visit. I know they will.”