Finished the Exit function