Added an exit routine