Refactor stub_command into global before block