added exit function