getroutes method.
Beefed up exception handling, improved comments.