implemented function toggle