updating toggle function