Modify to change the state of the switches depending on whether available