Code modified to accept command line arguments