Added the exited handler