Made some changes to the code to get
the command line script working.