Abandoned mines pose significant threats to society, yet a large fraction of them lack accurate maps. This article discusses the software architecture of an autonomous robotic system designed to explore and map abandoned mines. We have built a robot capable of autonomously exploring abandoned mines. A new set of software tools is presented, enabling robots to acquire maps of unprecedented size and accuracy. On May 30, 2003, our robot "Groundhog" successfully explored and mapped a main corridor of the abandoned Mathies mine near Courtney, PA. The article also discusses some of the challenges that arise in the subterraneans environments, and some the difficulties of building truly autonomous robots.