Main has been modified to work woth command line