use previously defined toggle function