altered exit function