move argument parsing to main() to allow doctests