update toggle function