improved handling of command line arguments