first version with command line arguments