implemented a way to quit