modify toggle function