complete toggle function