edit exit function