Added an exit function.