added ability to run main() function through command line