This would generally be more usable as a library if it didn't trap all exceptions or didn't try to exit the program. Perhaps rescuing exceptions and then returning nil/empty hash, or allowing exceptions to percolate up and the caller to handle them?