refactor exit calls