port to process.argvs & refactoring