Added exit function too