clear and exit implemented