also allow command line arguments
reorganize a bit