modify the toggle function