refactored command line script
fixed up lint errrors