Revert "Rewrite the Exit code."

This reverts commit 9a7fc598d45f393e7a1c12dcbafd7cd229bd50c5.