Changed exit function