Added exit code support for CLI mode