working exit and read