making the module work either from command line or as a module