add if else condition to toggle boxes