conditional checking and toggle