updated for making a command-line script.