implemented exit function as config param