refactored "exit"