adding the toggle function