Added an exit function