Changed the exit functionality.