Refactored to move command line arguments into the library.