move command line parsing out of main