implemented exit