rearrange to allow specifying parmeters at command line